import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class InputAndForm extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => _InputAndForm();
}

class _InputAndForm extends State<InputAndForm> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("输入框及表单"),
      ),
      body: Column(
        children: <Widget>[
          TextField(
            autofocus: true,
            decoration: InputDecoration(
                labelText: "用户名",
                hintText: "用户名或邮箱",
                prefixIcon: Icon(Icons.person)),
          ),
          TextField(
            decoration: InputDecoration(
                labelText: "密码",
                hintText: "您的登录密码",
                prefixIcon: Icon(Icons.lock)),
            obscureText: true,
          ),
          GestureDetector(
            child: Container(
              height: 40.0,
              child: Center(
                child: Text(
                  "控制焦点",
                  textScaleFactor: 1.2,
                  style: TextStyle(color: Colors.blue),
                ),
              ),
            ),
            onTap: () {
              Navigator.pushNamed(context, "focus_test_route");
            },
          ),
          Divider(),
          GestureDetector(
            child: Container(
              height: 40.0,
              child: Center(
                child: Text("表单",
                    textScaleFactor: 1.2, style: TextStyle(color: Colors.blue)),
              ),
            ),
            onTap: () {
              Navigator.pushNamed(context, "form_test_route");
            },
          ),
          Divider(),
        ],
      ),
    );
  }
}
